> cospons <- read.csv("cosponsorships.csv", header = FALSE)
> names(cospons) <- c("lastname1", "lastname2", "degree")
> cospons.b <- cospons[1:4950, c("lastname2", "lastname1", "degree")]
> names(cospons.b) <- c("lastname1", "lastname2", "degree")
> cospons2 <- data.frame(rbind(cospons, cospons.b))
> cospons2 <- cospons2 %>% arrange(lastname2)
> cospons2 <- cospons2 %>% arrange(lastname1)
> nwk.cospons <- reshape(cospons2, v.names = "degree", timevar = "lastname2", 
+ direction = "wide", idvar = "lastname1")
> nwk.cospons <- as.matrix(nwk.cospons[1:nrow(nwk.cospons), 2:ncol(nwk.cospons)])
> cospons.cent <- read.csv("fowler108full.csv", header = TRUE)
> rownames(nwk.cospons) <- cospons.cent$labels
> colnames(nwk.cospons) <- cospons.cent$labels
> cospons.cent$net.ev <- evcent(nwk.cospons, ignore.eval = FALSE)
> full435 <- read.csv("full435.csv")[, 2:3]
> house <- read.csv("caucus.csv", header = FALSE)
> names(house) <- c("lastname1", "lastname2", "degree")
> house2 <- merge(full435, house, by = c("lastname1", "lastname2"), 
+ all.x = TRUE)
> house2 <- house2 %>% arrange(lastname2)
> house2 <- house2 %>% arrange(lastname1)
> house2$degree <- ifelse(is.na(house2$degree), 0, house2$degree)
> nwk.caucus <- reshape(house2, v.names = "degree", timevar = "lastname2", 
+ direction = "wide", idvar = "lastname1")
> nwk.caucus <- as.matrix(nwk.caucus[1:nrow(nwk.caucus), 2:ncol(nwk.caucus)])
> caucus.cent <- read.csv("110housefull.csv", header = FALSE)
> names(caucus.cent) <- "labels"
> caucus.cent <- caucus.cent %>% arrange(labels)
> rownames(nwk.caucus) <- caucus.cent$labels
> colnames(nwk.caucus) <- caucus.cent$labels
> nwk.caucus <- log(nwk.caucus + 1)
> caucus.cent$net.ev <- evcent(nwk.caucus, ignore.eval = FALSE)
> vicrin <- read.csv("victorringe.csv")
> caucus.val <- merge(vicrin, caucus.cent, by = "labels")
> caucus.val <- caucus.val[c(-11, -15), ]
> mexico <- read.csv("mexicoboard.csv", header = FALSE)
> names(mexico) <- c("lastname1", "lastname2", "degree")
> mexico.b <- mexico[1:253, c("lastname2", "lastname1", "degree")]
> names(mexico.b) <- c("lastname1", "lastname2", "degree")
> mexico2 <- data.frame(rbind(mexico, mexico.b))
> mexico2 <- mexico2 %>% arrange(lastname2)
> mexico2 <- mexico2 %>% arrange(lastname1)
> nwk.mexico <- reshape(mexico2, v.names = "degree", timevar = "lastname2", 
+ direction = "wide", idvar = "lastname1")
> nwk.mexico <- as.matrix(nwk.mexico[1:nrow(nwk.mexico), 2:ncol(nwk.mexico)])
> mexico.cent <- read.csv("mexico24.csv", header = FALSE)
> names(mexico.cent) <- "labels"
> mexico.cent <- mexico.cent %>% arrange(labels)
> rownames(nwk.mexico) <- mexico.cent$labels
> colnames(nwk.mexico) <- mexico.cent$labels
> nwk.mexico <- log(nwk.mexico + 1)
> mexico.cent$net.ev <- evcent(nwk.mexico, ignore.eval = FALSE)
> apira <- read.csv("apira.csv")
> mexico.val <- merge(apira, mexico.cent, by = "labels")
> g1 <- ggplot(cospons.cent, aes(x = net.ev, y = evcent, label = lastname))
> rho1 <- with(cospons.cent, cor(net.ev, evcent))
> lbl1 <- paste(expression(rho), " == ", round(rho1, 3))
> p1 <- g1 + geom_point(size = 3) + ylim(0, 0.15) + geom_smooth(method = "lm") + 
+ labs(x = "Eigenvector centrality (Google correlations)", 
+ 
+ y = "Eigenvector centrality (Fowler)") + annotate("text", 
+ label = lbl1, x = 0.03, y = 0.145, parse = TRUE, col = "darkred") + 
+ annotate("text", label = c("Cochran", "Frist", "Lautenberg", 
+ 
+ "Shelby", "Carper", "Bennett"), x = c(0.157, 0.035, 0.183, 
+ 
+ 0.155, 0.09, 0.04), y = c(0.093, 0.13, 0.064, 0.0402, 
+ 
+ 0.0115, 0.015)) + theme_classic()
> g2 <- ggplot(caucus.val, aes(x = net.ev, y = evcent))
> rho2 <- cor(caucus.val$evcent, caucus.val$net.ev)
> lbl2 <- paste(expression(rho), " == ", round(rho2, 3))
> p2 <- g2 + geom_point(size = 3) + geom_smooth(method = "lm") + 
+ labs(x = "Eigenvector Centrality (Google correlations)", 
+ 
+ y = "Eigenvector Centrality (Victor-Ringe)") + annotate("text", 
+ label = lbl2, x = 0.08, y = 15.2, parse = TRUE, col = "darkred") + 
+ annotate("text", label = c("Waxman", "Doggett", "Smith", 
+ 
+ "Holt"), x = c(0.4, 0.13, 0.34, 0.14), y = c(15.16, 14.2, 
+ 
+ 12.61, 12.44)) + theme_classic()
> g3 <- ggplot(mexico.val[!is.na(mexico.val$evcent), ], aes(x = net.ev, 
+ y = evcent))
> rho3 <- cor(mexico.val[, c("evcent", "net.ev")], use = "pairwise.complete.obs")[1, 
+ 2]
> lbl3 <- paste(expression(rho), " == ", round(rho3, 3))
> p3 <- g3 + geom_point(size = 3) + geom_smooth(method = "lm") + 
+ labs(x = "Eigenvector Centrality (Google correlations)", 
+ 
+ y = "Eigenvector Centrality (Avina-Vazquez)") + annotate("text", 
+ label = lbl3, x = 0.08, y = 0.266, parse = TRUE, col = "darkred") + 
+ annotate("text", label = c("Corral", "Perez", "Gual", "Gonzalez"), 
+ 
+ x = c(0.19, 0.15, 0.31, 0.33), y = c(0.189, 0.228, 0.213, 
+ 
+ 
+ 0.2525)) + theme_classic()
> g <- grid.arrange(p1, p2, p3, ncol = 3)
> ggsave(plot = g, filename = "AppendixFigure4.png", width = 18, 
+ height = 6, units = "in", dpi = 600)
